package com.bestcem.xm.member.util;

import com.bestcem.xm.member.constant.ExcelFieldConstants;
import com.bestcem.xm.member.controller.vo.EmployeeStatusVO;
import com.bestcem.xm.member.service.dto.MetaFieldChoiceDTO;
import com.bestcem.xm.member.service.dto.MetaFieldDTO;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.*;

/**
 * 公共常量类
 *
 * @author zhenz
 * @date 2020/6/1 18:51
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Constants {

    /**
     * 联系人字段长度
     */
    public static final Integer MEMBER_NAME_MAX_LENGTH = 32;

    public static final Integer MEMBER_GENDER_MAX_LENGTH = 10;

    /**
     * 标签默认名称 key
     */
    public static final String LABEL_DEFAULT_NAME_KEY = "member:tag_default_name_";

    /**
     * 标签组默认名称序号 key
     */
    public static final String LABEL_GROUP_DEFAULT_NAME_KEY = "member:tag_group_default_name_";

    /**
     * 扩展字段默认名称序号 key
     */
    public static final String FIELD_DEFAULT_NAME_KEY = "member:field_default_name_";


    public static final Map<Integer, String> SEQUENCE_NAME_MAP = new HashMap<>();

    static {
        SEQUENCE_NAME_MAP.put(1, LABEL_DEFAULT_NAME_KEY);
        SEQUENCE_NAME_MAP.put(2, LABEL_GROUP_DEFAULT_NAME_KEY);
        SEQUENCE_NAME_MAP.put(3, FIELD_DEFAULT_NAME_KEY);
    }


    /**
     * 默认标签组最大容量
     */
    public static final Integer MAX_LABEL_GROUP_SIZE = 20;

    /**
     * 默认标签最大容量
     */
    public static final Integer MAX_LABEL_SIZE = 200;

    /**
     * 默认标签值最大容量
     */
    public static final Integer MAX_LABEL_VALUE_SIZE = 30;

    /**
     * 默认标签组名称最大长度
     */
    public static final Integer MAX_LABEL_GROUP_NAME_LENGTH = 30;

    /**
     * 默认标签名称最大长度
     */
    public static final Integer MAX_LABEL_NAME_LENGTH = 30;

    /**
     * 默认标签值名称最大长度
     */
    public static final Integer MAX_LABEL_VALUE_NAME_LENGTH = 30;

    /**
     * 免费版联系人数量
     */
    public static final long FREE_USER_MEMBER_NUMBER = 100;

    /**
     * 联系人开放平台最大创建、更新条数
     */
    public static final Integer OPEN_PLATFORM_MAX_OPERATION_MEMBER_NUMBER = 20000;

    /**
     * 最大单页查询联系人数量
     */
    public static final Integer MAX_MEMBER_AMOUNT_SINGLE_PAGE = 1000;

    /**
     * 联系人过滤组织层级，“in”查询最大叶子门店数量
     * 超过该值则关联查询
     */
    public static final Integer STORE_IN_SEARCH_MAX_COUNT = 300;

    /**
     * 联系人微信导入标识
     */
    public static final String WECHAT_IMPORT = "wechat";

    /**
     * 数字1
     */
    public static final Integer ONE = 1;

    /**
     * 数字-1
     */
    public static final Integer NEGATIVE = -1;

    /**
     * 数字999
     */
    public static final Integer MAX_MILLISECOND = 999;

    /**
     * 地址缓存key
     */
    public static final String CITY_LEVEL_KEY = "member:city_level";

    /**
     * 地址文件路径
     */
    public static final String CITY_FIELD_PATH = "survey/city.json";

    /**
     * 成功
     */
    public static final String SUCCESS = "success";

    /**
     * 无状态
     */
    private static final String MEMBER_EMPLOYEE_STATUS_IGNORE = "无状态,表示不是非内部联系人";

    /**
     * 在职
     */
    private static final String MEMBER_EMPLOYEE_STATUS_WORK = "在职";

    /**
     * 离职
     */
    private static final String MEMBER_EMPLOYEE_STATUS_LEAVE = "离职";

    /**
     * 分页参数 最大页数
     */
    public static final int MAX_PAGE_SIZE = 1000;
    /**
     * 分页参数 最小页数
     */
    public static final int MIN_PAGE_SIZE = 1;

    /**
     * 表头 -字符串
     */
    public static final String EXCEL_TYPE_STR = "string";

    /**
     * 表头 -数字
     */
    public static final String EXCEL_TYPE_NUMBER = "number";

    /**
     * 默认标签组名称
     */
    public static final String DEFAULT_LABEL_GROUP_NAME = "未分组";

    /**
     * 默认标签单次查询最大数量
     */
    public static final Integer DEFAULT_LABEL_MAX_SINGLE_PAGE = 1000;

    /**
     * 分页缺省时的默认值
     */
    public static final Integer DEFAULT_PAGE = 1;

    public static final Integer DEFAULT_LARGE_PAGE_SIZE = 1000;

    /**
     * 表头 -日期
     */
    public static final String EXCEL_TYPE_DATE = "date";

    public static final Map<Integer, String> EMPLOYEE_STATUS_MAP = new HashMap<>();

    static {
        EMPLOYEE_STATUS_MAP.put(1, MEMBER_EMPLOYEE_STATUS_IGNORE);
        EMPLOYEE_STATUS_MAP.put(2, MEMBER_EMPLOYEE_STATUS_WORK);
        EMPLOYEE_STATUS_MAP.put(3, MEMBER_EMPLOYEE_STATUS_LEAVE);
    }

    public static final List<MetaFieldDTO> COMPUTES_INFO = Arrays.asList(
            new MetaFieldDTO("答题率", "answer_rate", "number", "computes", new ArrayList<>()),
            new MetaFieldDTO("答题完成率", "submit_rate", "number", "computes", new ArrayList<>()),
            new MetaFieldDTO("收到问卷数", "receive_total_count", "number", "computes", new ArrayList<>()),
            new MetaFieldDTO("开始答题问卷数", "start_answer_count", "number", "computes", new ArrayList<>())
    );

    /**
     * 个人联系人基本字段
     */
    public static final List<MetaFieldDTO> INDIV_INFO = Arrays.asList(
            new MetaFieldDTO("外部编号", "out_no", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("姓名", "name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("性别", "gender", "select", "info", Arrays.asList("男", "女")),
            new MetaFieldDTO("省份", "address.0", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("城市", "address.1", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("区县", "address.2", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("街道信息", "address.3", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("手机号", "mobile", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("邮箱", "email", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("出生日期", "birthday", "datetime", "info", new ArrayList<>()),
            new MetaFieldDTO("年龄", "age", "number", "info", new ArrayList<>()),
            new MetaFieldDTO("所属组织", "store", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("微信OpenID", "openid", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("微信AppID", "appid", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("支付宝ID", "alipay_user_id", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("黑名单", "deliver_status", "choose", "info", Arrays.asList(new MetaFieldChoiceDTO(2, "是"), new MetaFieldChoiceDTO(1, "否"))),
            new MetaFieldDTO("邮件退订", "subscribe_status", "choose", "info", Arrays.asList(new MetaFieldChoiceDTO(2, "是"), new MetaFieldChoiceDTO(1, "否")))
    );

    /**
     * 机构联系人基本信息
     */
    public static final List<MetaFieldDTO> INSTITUT_INFO = Arrays.asList(
            new MetaFieldDTO("外部编号", "out_no", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("机构对接人", "name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("机构名称", "institut_name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("所属部门", "department", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("职位", "position", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("省份", "address.0", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("城市", "address.1", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("区县", "address.2", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("街道信息", "address.3", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("手机号", "mobile", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("邮箱", "email", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("所属组织", "store", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("邮件退订", "subscribe_status", "choose", "info", Arrays.asList(new MetaFieldChoiceDTO(2, "是"), new MetaFieldChoiceDTO(1, "否")))
    );

    /**
     * 内部联系人基本信息
     */
    public static final EmployeeStatusVO EMPLOYEE_STATUS_1 = new EmployeeStatusVO(1, "在职");
    public static final EmployeeStatusVO EMPLOYEE_STATUS_2 = new EmployeeStatusVO(2, "离职");
    public static final List<MetaFieldDTO> INNER_INFO = Arrays.asList(
            new MetaFieldDTO("姓名", "name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("性别", "gender", "select", "info", Arrays.asList("男", "女")),
            new MetaFieldDTO("省份", "address.0", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("城市", "address.1", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("区县", "address.2", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("街道信息", "address.3", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("手机号", "mobile", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("邮箱", "email", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("出生日期", "birthday", "datetime", "info", new ArrayList<>()),
            new MetaFieldDTO("年龄", "age", "number", "info", new ArrayList<>()),
            new MetaFieldDTO("所属组织", "store", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("员工编号", "employeeID", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("员工状态", "employee_status", "select", "info", Arrays.asList(EMPLOYEE_STATUS_1, EMPLOYEE_STATUS_2))
    );

    /**
     * 项目基本信息
     */
    public static final List<MetaFieldDTO> PROJECT_BASE_INFO = Arrays.asList(
            new MetaFieldDTO("机构对接人", "member.name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("机构名称", "member.institut_name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("所属部门", "member.department", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("职位", "member.position", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("省份", "member.address.0", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("城市", "member.address.1", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("区县", "member.address.2", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("街道信息", "member.address.3", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("手机号", "member.mobile", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("邮箱", "member.email", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("所属组织", "member.store", "level", "info", new ArrayList<>())
    );

    /**
     * 项目信息
     */
    public static final List<MetaFieldDTO> PROJECT_INFO = Arrays.asList(
            new MetaFieldDTO("项目编号", "m_project_code", "string", "project", new ArrayList<>()),
            new MetaFieldDTO("项目名称", "m_project_name", "string", "project", new ArrayList<>()),
            new MetaFieldDTO("立项类型", "m_p_type", "string", "project", new ArrayList<>()),
            new MetaFieldDTO("合同编号", "contractNo", "string", "project", new ArrayList<>()),
            new MetaFieldDTO("合同金额", "contract_money", "number", "project", new ArrayList<>()),
            new MetaFieldDTO("立项时间", "project_time", "datetime", "project", new ArrayList<>()),
            new MetaFieldDTO("客户经理", "account_manager", "string", "project", new ArrayList<>()),
            new MetaFieldDTO("甲方项目经理", "project_manager", "datetime", "project", new ArrayList<>()),
            new MetaFieldDTO("项目经理手机", "project_manager_mobile", "string", "project", new ArrayList<>()),
            new MetaFieldDTO("项目状态", "m_p_status", "string", "project", new ArrayList<>()),
            new MetaFieldDTO("计划开始时间", "program_start", "datetime", "project", new ArrayList<>()),
            new MetaFieldDTO("实际开始时间", "actual_start", "datetime", "project", new ArrayList<>()),
            new MetaFieldDTO("验收时间", "acceptance_time", "datetime", "project", new ArrayList<>())
    );

    /**
     * 个人联系人excel基础表头
     */
    public static final List<String> INDIVIDUAL_BASE_EXCEL_HEADERS = Arrays.asList(
            "姓名",
            "微信昵称",
            "性别",
            "出生日期",
            "手机号",
            "邮箱",
            "省份",
            "城市",
            "区县",
            "街道信息",
            "所属组织",
            "微信AppID",
            "微信OpenID",
            "支付宝ID"
    );

    /**
     * 个人联系人导出excel基础表头
     */
    public static final List<String> INDIVIDUAL_EXPORT_BASE_EXCEL_HEADERS = Arrays.asList(
            "姓名",
            "性别",
            "出生日期",
            "年龄",
            "手机号",
            "邮箱",
            "省份",
            "城市",
            "区县",
            "街道信息",
            "所属组织",
            "微信AppID",
            "微信OpenID",
            "支付宝ID"
    );

    /**
     * 机构联系人excel基础表头
     */
    public static final List<String> INSTITUTION_BASE_EXCEL_HEADERS = Arrays.asList(
            "机构名称",
            "机构对接人",
            "所属部门",
            "职位",
            "手机号",
            "邮箱",
            "省份",
            "城市",
            "区县",
            "街道信息",
            "所属组织"
    );

    /**
     * 内部联系人excel基础表头
     */
    public static final List<String> INTERIOR_BASE_EXCEL_HEADERS = Arrays.asList(
            "姓名",
            "性别",
            "出生日期",
            "手机号",
            "邮箱",
            "省份",
            "城市",
            "区县",
            "街道信息",
            "所属组织",
            "员工编号",
            "员工状态"
    );

    /**
     * 内部联系人导出excel基础表头
     */
    public static final List<String> INTERIOR_EXPORT_BASE_EXCEL_HEADERS = Arrays.asList(
            "姓名",
            "性别",
            "出生日期",
            "年龄",
            "手机号",
            "邮箱",
            "省份",
            "城市",
            "区县",
            "街道信息",
            "所属组织",
            "员工编号",
            "员工状态"
    );

    /**
     * 内部联系人excel基础表头
     */
    public static final List<String> M_PROJECT_BASE_EXCEL_HEADERS = Arrays.asList(
            "机构名称",
            "项目编号",
            "项目名称",
            "甲方项目经理",
            "项目经理手机",
            "项目状态",
            "立项类型",
            "立项时间",
            "客户经理",
            "合同编号",
            "合同金额",
            "计划开始时间",
            "验收时间",
            "实际开始时间"
    );

    /**
     * 主键key
     */
    public static final Map<String, String> PRIMARY_KEY_MAP = new HashMap<>();

    static {
        PRIMARY_KEY_MAP.put("mobile", "手机号");
        PRIMARY_KEY_MAP.put("email", "邮箱");
        PRIMARY_KEY_MAP.put("out_no", "外部编号");
        PRIMARY_KEY_MAP.put("employeeID", "员工编号");
        PRIMARY_KEY_MAP.put("appid", "微信AppID");
        PRIMARY_KEY_MAP.put("openid", "微信OpenID");
    }

    public static final Map<Integer, String> PROGRESS_BAR_OPERATION_MAP = new HashMap<>();

    static {
        PROGRESS_BAR_OPERATION_MAP.put(0, "member:member.import");
        PROGRESS_BAR_OPERATION_MAP.put(1, "member:member.export");
    }


    /**
     * 个人联系人 name与field映射
     */
    public static final Map<String, String> INDIV_FIELD_NAME_AND_FIELD_MAP = new HashMap<>();

    static {
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("姓名", ExcelFieldConstants.IND_NAME);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("微信昵称", ExcelFieldConstants.IND_NICKNAME);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("手机号", ExcelFieldConstants.IND_MOBILE);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("邮箱", ExcelFieldConstants.IND_EMAIL);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("微信AppID", ExcelFieldConstants.IND_APP_ID);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("微信OpenID", ExcelFieldConstants.IND_OPEN_ID);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("支付宝ID", ExcelFieldConstants.IND_ALI_PAY_USER_ID);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("性别", ExcelFieldConstants.IND_GENDER);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("出生日期", ExcelFieldConstants.IND_BIRTHDAY);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("所属组织", ExcelFieldConstants.IND_STORE);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("省份", ExcelFieldConstants.PROVINCE);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("城市", ExcelFieldConstants.CITY);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("区县", ExcelFieldConstants.DISTRICT);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("街道信息", ExcelFieldConstants.STREET);
        INDIV_FIELD_NAME_AND_FIELD_MAP.put("外部编号", ExcelFieldConstants.IND_OUT_NO);
    }

    /**
     * 机构联系人 name与field映射
     */
    public static final Map<String, String> INSTI_FIELD_NAME_AND_FIELD_MAP = new HashMap<>();

    static {
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("机构名称", ExcelFieldConstants.INS_INSTITUTE_NAME);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("机构对接人", ExcelFieldConstants.INS_NAME);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("所属部门", ExcelFieldConstants.INS_DEPARTMENT);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("职位", ExcelFieldConstants.INS_POSITION);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("手机号", ExcelFieldConstants.INS_MOBILE);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("邮箱", ExcelFieldConstants.INS_EMAIL);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("所属组织", ExcelFieldConstants.INS_STORE);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("省份", ExcelFieldConstants.PROVINCE);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("城市", ExcelFieldConstants.CITY);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("区县", ExcelFieldConstants.DISTRICT);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("街道信息", ExcelFieldConstants.STREET);
        INSTI_FIELD_NAME_AND_FIELD_MAP.put("外部编号", ExcelFieldConstants.INS_OUT_NO);
    }

    /**
     * 内部联系人 name与field映射
     */
    public static final Map<String, String> INTER_FIELD_NAME_AND_FIELD_MAP = new HashMap<>();

    static {
        INTER_FIELD_NAME_AND_FIELD_MAP.put("姓名", ExcelFieldConstants.INT_NAME);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("手机号", ExcelFieldConstants.INT_MOBILE);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("邮箱", ExcelFieldConstants.INT_EMAIL);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("性别", ExcelFieldConstants.INT_GENDER);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("出生日期", ExcelFieldConstants.INT_BIRTHDAY);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("所属组织", ExcelFieldConstants.INT_STORE);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("员工编号", ExcelFieldConstants.INT_EMPLOYEE_ID);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("员工状态", ExcelFieldConstants.INT_EMPLOYEE_STATUS);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("省份", ExcelFieldConstants.PROVINCE);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("城市", ExcelFieldConstants.CITY);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("区县", ExcelFieldConstants.DISTRICT);
        INTER_FIELD_NAME_AND_FIELD_MAP.put("街道信息", ExcelFieldConstants.STREET);
    }

    /**
     * 项目 name与field映射
     */
    public static final Map<String, String> PROJECT_FIELD_NAME_AND_FIELD_MAP = new HashMap<>();

    static {
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("机构名称", ExcelFieldConstants.PROJECT_INSTITUTE_NAME);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("项目编号", ExcelFieldConstants.PROJECT_PROJECT_CODE);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("项目名称", ExcelFieldConstants.PROJECT_PROJECT_NAME);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("立项类型", ExcelFieldConstants.PROJECT_PROJECT_TYPE);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("合同编号", ExcelFieldConstants.PROJECT_CONTRACT_NO);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("合同金额", ExcelFieldConstants.PROJECT_CONTRACT_MONEY);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("立项时间", ExcelFieldConstants.PROJECT_PROJECT_TIME);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("客户经理", ExcelFieldConstants.PROJECT_ACCOUNT_MANAGER);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("甲方项目经理", ExcelFieldConstants.PROJECT_PROJECT_MANAGER);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("计划开始时间", ExcelFieldConstants.PROJECT_PROGRAM_START);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("实际开始时间", ExcelFieldConstants.PROJECT_ACTUAL_START);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("验收时间", ExcelFieldConstants.PROJECT_ACCEPTANCE_TIME);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("项目状态", ExcelFieldConstants.PROJECT_PROJECT_STATUS);
        PROJECT_FIELD_NAME_AND_FIELD_MAP.put("项目经理手机", ExcelFieldConstants.PROJECT_PROJECT_MANAGER_MOBILE);
    }

    /**
     * 联系人 地址字段
     */
    public static final List<String> ADDRESS_FIELDS = Arrays.asList(
            "省份",
            "城市",
            "区县",
            "街道信息"
    );

    /**
     * 联系人 性别
     */
    public static final List<String> MEMBER_GENDER = Arrays.asList(
            "男",
            "女"
    );

    /**
     * 扩展字段联系人类型 个人联系人
     */
    public static final Integer M_FIELD_ATTRIBUTE_INDIVIDUAL = 0;

    /**
     * 扩展字段联系人类型 机构联系人
     */
    public static final Integer M_FIELD_ATTRIBUTE_INSTITUTION = 1;

    /**
     * 扩展字段联系人类型 内部联系人
     */
    public static final Integer M_FIELD_ATTRIBUTE_INTERIOR = 2;

    /**
     * 扩展字段联系人类型 项目信息
     */
    public static final Integer M_FIELD_ATTRIBUTE_PROJECT = 3;
    /**
     * 扩展字段联系人状态
     */
    public static final Map<Integer, String> M_FIELD_ATTRIBUTE_MAP = new HashMap<>();

    static {
        M_FIELD_ATTRIBUTE_MAP.put(M_FIELD_ATTRIBUTE_INDIVIDUAL, "个人联系人");
        M_FIELD_ATTRIBUTE_MAP.put(M_FIELD_ATTRIBUTE_INSTITUTION, "机构联系人");
        M_FIELD_ATTRIBUTE_MAP.put(M_FIELD_ATTRIBUTE_INTERIOR, "内部联系人");
        M_FIELD_ATTRIBUTE_MAP.put(M_FIELD_ATTRIBUTE_PROJECT, "项目信息");
    }

    /**
     * 扩展字段最大限制数量
     */
    public static final Integer MAX_EXTEND_FIELD_AMOUNT = 20;

    /**
     *
     */
    public static final List<String> FIELD_VALUE_TYPE = Arrays.asList(
            "string",
            "number",
            "datetime",
            "select",
            "level",
            "address"
    );

    public static final List<Integer> EXCEL_FIELD_VALUE_TYPE = Arrays.asList(
            0,
            4,
            5
    );

    public static final Map<String, String> PUSH_TYPE_MAP = new HashMap<>();

    static {
        PUSH_TYPE_MAP.put("wechat", "wechat");
        PUSH_TYPE_MAP.put("alipay", "alipay_user_id");
        PUSH_TYPE_MAP.put("mobile", "phone");
        PUSH_TYPE_MAP.put("email", "email");
        PUSH_TYPE_MAP.put("interface", "interface");
    }

    /**
     * 个人联系人默认查询字段
     */
    public static final List<String> INDIVIDUAL_DEFAULT_QUERY_FIELD = Arrays.asList(
            "姓名",
            "联系人编号",
            "手机号",
            "邮箱",
            "性别",
            "年龄",
            "所属组织",
            "地区",
            "微信OpenID",
            "支付宝ID",
            "创建时间"
    );

    /**
     * 机构联系人默认查询字段
     */
    public static final List<String> INSTITUTION_DEFAULT_QUERY_FIELD = Arrays.asList(
            "机构名称",
            "联系人编号",
            "机构对接人",
            "所属部门",
            "所属组织",
            "所属城市",
            "手机号",
            "邮箱",
            "所属门店",
            "创建时间"
    );

    /**
     * 内部联系人默认查询字段
     */
    public static final List<String> INTERIOR_DEFAULT_QUERY_FIELD = Arrays.asList(
            "姓名",
            "联系人编号",
            "地区",
            "手机号",
            "邮箱",
            "性别",
            "所属组织",
            "员工编号",
            "员工状态",
            "创建时间"
    );

    /**
     * 个人联系人基本字段,默认查询顺序
     */
    public static final List<MetaFieldDTO> INDIVIDUAL_QUERY_FIELD = Arrays.asList(
            new MetaFieldDTO("联系人编号", "memberNo", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("外部编号", "out_no", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("姓名", "name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("微信昵称", "nickname", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("手机号", "mobile", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("邮箱", "email", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("性别", "gender", "select", "info", Arrays.asList("男", "女")),
            new MetaFieldDTO("年龄", "age", "number", "info", new ArrayList<>()),
            new MetaFieldDTO("出生日期", "birthday", "datetime", "info", new ArrayList<>()),
            new MetaFieldDTO("所属组织", "org_name", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("组织编码", "user_group_code", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("地区", "address", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("微信OpenID", "openid", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("微信UnionID", "union_id", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("微信AppID", "appid", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("支付宝ID", "alipay_user_id", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("创建时间", "createdDT", "datetime", "info", new ArrayList<>())
    );

    /**
     * 机构联系人基本信息
     */
    public static final List<MetaFieldDTO> INSTITUT_QUERY_FIELD = Arrays.asList(
            new MetaFieldDTO("联系人编号", "memberNo", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("外部编号", "out_no", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("机构名称", "institut_name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("所属城市", "address.1", "address", "info", new ArrayList<>()),
            new MetaFieldDTO("机构对接人", "name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("所属部门", "department", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("手机号", "mobile", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("邮箱", "email", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("所属组织", "org_name", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("所属门店", "store_name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("创建时间", "createdDT", "datetime", "info", new ArrayList<>())
    );

    /**
     * 内部联系人基本信息
     */
    public static final List<MetaFieldDTO> INNER_QUERY_FIELD = Arrays.asList(
            new MetaFieldDTO("联系人编号", "memberNo", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("员工编号", "employeeID", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("姓名", "name", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("手机号", "mobile", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("邮箱", "email", "string", "info", new ArrayList<>()),
            new MetaFieldDTO("性别", "gender", "select", "info", Arrays.asList("男", "女")),
            new MetaFieldDTO("年龄", "age", "number", "info", new ArrayList<>()),
            new MetaFieldDTO("出生日期", "birthday", "datetime", "info", new ArrayList<>()),
            new MetaFieldDTO("地区", "address", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("所属组织", "org_name", "level", "info", new ArrayList<>()),
            new MetaFieldDTO("员工状态", "employee_status", "select", "info", Arrays.asList(1, 2)),
            new MetaFieldDTO("创建时间", "createdDT", "datetime", "info", new ArrayList<>())
    );

    /**
     * 联系人导出表头 v2
     */
    public static final List<String> INDIVIDUAL_EXCEL_EXPORT_HEADERS =
            Arrays.asList("联系人编号", "外部编号", "姓名", "微信昵称", "手机号", "邮箱", "性别", "年龄", "出生日期", "所属组织", "省份", "城市", "区县", "街道信息", "微信OpenID", "微信AppID", "支付宝ID", "创建时间", "黑名单", "邮件退订");

    public static final List<String> INSTITUTION_EXCEL_EXPORT_HEADERS =
            Arrays.asList("联系人编号", "外部编号", "机构名称", "省份", "城市", "区县", "街道信息", "机构对接人", "所属部门", "手机号", "邮箱", "所属组织", "所属门店", "创建时间", "邮件退订");

    public static final List<String> INTERIOR_EXCEL_EXPORT_HEADERS =
            Arrays.asList("联系人编号", "员工编号", "姓名", "手机号", "邮箱", "性别", "年龄", "出生日期", "省份", "城市", "区县", "街道信息", "所属组织", "员工状态", "创建时间");


    /**
     * 30秒 单位:毫秒
     * <p>
     * <p>30 * 1000 = 30000 ms
     */
    public static final int THIRTY_SECOND_UNIT_MILLIS = 30000;

    /**
     * 5min 单位:毫秒
     * <p>
     * <p>5 * 60  * 1000 = 30000 ms
     */
    public static final int FIVE_MIN_UNIT_MILLIS = 5 * 60 * 1000;

    /**
     * 针对分组seq上锁的锁前缀
     */
    public static final String GROUP_LOCK_PREFIX = "member:group:lock:";

    /**
     * 针对订阅、退订上锁的锁前缀
     */
    public static final String SUBSCRIBE_SEMAPHORE_PREFIX = "member:subscribe:semaphore:";

    /**
     * 针对加入、移除黑名单上锁的锁前缀
     */
    public static final String BLACKLIST_SEMAPHORE_PREFIX = "member:blacklist:semaphore:";

    /**
     * 针对分组seq上锁的锁总数量
     */
    public static final Integer GROUP_LOCK_TOTAL_COUNT = 128;

    /**
     * 告警毫秒值，5分钟，保留5秒的时间
     */
    public static final Long GROUP_LOCK_WARNING_MILLISECOND_VALUE = 1000L * (60 * 5 - 5);

    /**
     * 黑名单 告警毫秒值，5分钟，保留5秒的时间
     */
    public static final Long BLACKLIST_LOCK_WARNING_MILLISECOND_VALUE = 1000L * (60 * 5 - 5);

    /**
     * 联系人导入加锁时长
     */
    public static final int MEMBER_IMPORT_LOCK_TIME = 60 * 10;

    /**
     * 套餐中，个人联系人限额的名称
     */
    public static final String PACKAGE_KEY_MEMBER_IND_QUOTA = "member_ind_quota";

    /**
     * 联系人编号生成时的格式
     */
    public static final String MEMBER_NO_PATTERN = "00000000";

}
